fix(kamp): let BED_MESH_CALIBRATE callers choose the profile; save adaptive meshes as adaptive, not default - #39
Open
arlophoenix wants to merge 1 commit into
Conversation
KAMP's BED_MESH_CALIBRATE wrapper in Adaptive_Meshing.cfg calls through to _BED_MESH_CALIBRATE without forwarding PROFILE, so Klipper's bed_mesh.py defaults it to "default" and every adaptive calibration overwrites the full-bed mesh with a part-area one. Forward params.PROFILE when the caller supplies it, and have both Start_Print variants name the profile they already save and load (SAVE=adaptive / LOAD=adaptive) on the adaptive branch. Callers that pass no PROFILE - the vendor prtouch path, manual G29, console BED_MESH_CALIBRATE - render an empty suffix and still save to "default" exactly as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
KAMP's
BED_MESH_CALIBRATEwrapper never forwards aPROFILEto the built-in it renames, so Klipper defaults it todefault(bed_mesh.py:638) and every adaptive calibration overwrites the full-bed mesh with one covering only the part area. On a stock K1-family install that profile is what the printer loads at connect and what a power-loss resume restores.The result persists to disk:
G29,INPUTSHAPER,BEDPID, thebed_meshupdate_meshwebhook, the vendor'sprtouchpath andCXSAVE_CONFIGall flush Klipper's pending buffer into the#*#autosave block. On one affected K1C, a backup from 2026-06-16 (printer-20260616_221553.cfg) has[bed_mesh default]holding a 3×3 grid over a 16 mm square, on a 220 mm bed.The fix
The wrapper now forwards
params.PROFILEwhen the caller supplies one, and bothStart_Printvariants passPROFILE=adaptiveon their adaptive branch. Both variants change becausescripts/kamp.sh:43-47links one or the other by model. All three hunks are needed: the KAMP change alone does nothing, sinceStart_Printpasses noPROFILEtoday.Start_Printalready uses the nameadaptiveon the following two lines, inBED_MESH_PROFILE SAVE=adaptiveandLOAD=adaptive. Passing it to the calibrate call keeps the name in the caller, soAdaptive_Meshing.cfgneeds no reference to this repo's pins or profile names.Callers that pass no
PROFILE, including the vendor path, manualG29and consoleBED_MESH_CALIBRATE, render an empty parameter and still save todefault. Their emitted gcode is identical apart from one inert trailing space.BED_MESH_PROFILE SAVE=adaptiveon the next line stays. It is now a duplicate save under the same name, kept so that anyone who updatesStart_Print.cfgwhile still running an olderAdaptive_Meshing.cfg, which swallowsPROFILE, still getsdefaultcopied toadaptiveand a working print.Known limitations
This fixes the adaptive path only. The FULL BED MESH toggle reaches the same wrapper with polygons already registered, and KAMP adapts to the part area regardless of the toggle, so that path still writes a part-area mesh to
defaultafter this PR. It is a separate defect and can be filed separately.The wrapper also still drops other caller parameters, such as the
PROBE_COUNTthatBED_LEVELINGpasses atfiles/macros/useful-macros.cfg:121. That is a KAMP-upstream design question, out of scope here.Test plan
1.3.3.46: adaptive branch stagesbed_mesh adaptive, on-diskdefaultbyte-identical before and afterG29with no polygons refreshesdefault, leavesadaptiveuntouched, reloads asdefaultafter restartadaptivenames inStart_Printagree